package com.juc.phaser.phaser17;

import java.util.concurrent.Phaser;

public class ThreadA extends Thread{
    /**
     * 前面是线程一起到达屏障后继续运行
     *  有时候需要控制 也就是到达屏障后不允许继续运行
     */
	private Phaser phaser;
	
	public ThreadA(Phaser phaser){
		super();
		this.phaser = phaser;
	}
	@Override
	public void run() {
		System.out.println(Thread.currentThread().getName() + " A1 begin = " +System.currentTimeMillis());
		phaser.arriveAndAwaitAdvance();
		System.out.println(Thread.currentThread().getName() + " A1 end = " +System.currentTimeMillis());
	}
}
